package com.tianji.learning.controller;


import com.tianji.api.dto.leanring.LearningLessonDTO;
import com.tianji.api.dto.leanring.LearningRecordDTO;
import com.tianji.api.dto.leanring.LearningRecordFormDTO;
import com.tianji.learning.service.ILearningLessonService;
import com.tianji.learning.service.ILearningRecordService;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 学习记录表 前端控制器
 * </p>
 *
 * @author hrz
 * @since 2025-08-28
 */
@RestController
@RequestMapping("/learning-record")
@RequiredArgsConstructor
public class LearningRecordController {
    final ILearningLessonService learningLessonService;
    final ILearningRecordService learningRecordService;

    @GetMapping("/course/{courseId}")
    @ApiOperation("根据课程id查询学习记录")
    LearningLessonDTO queryLearningRecordByCourse(@PathVariable("courseId") Long courseId){
        return learningLessonService.queryLearningRecordByCourse(courseId);
    }

    @PostMapping
    @ApiOperation("前端向后端提交学习记录")
    public void submitLearningRecord(@RequestBody LearningRecordFormDTO dto){
        learningRecordService.submitLearningRecord(dto);
    }


}
